<%@page import="com.gym.model.entity.Customer"%>
<%@page import="com.gym.model.entity.User"%>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>

<%@ taglib uri="urihtml" prefix="html" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Modifica profilo</title>
<jsp:include page="/jsp/menu.jsp" />
</head>
<%
String errore = (String)request.getAttribute("errore");
String feedback = (String)request.getAttribute("feedback");

Customer c = (Customer) request.getAttribute("customer");
User u = (User) session.getAttribute("user");
%>
<body>
<div id="first">
	<html:form action="updateCustomer.do" method="get" >
		<label>Email <html:text property="email" styleClass="form" value="<%=u.getEmail() %>" /> </label> <html:errors bundle="errorsCustomer" property="email" />
		<br><br>
			<label>Nome <html:text property="firstname" styleClass="form" value="<%=c.getFirstname() %>" /> </label> <html:errors bundle="errorsCustomer" property="firstname" />
		<br><br>
		<label>Cognome <html:text property="lastname" styleClass="form" value="<%=c.getLastname() %>" /> </label> <html:errors bundle="errorsCustomer" property="lastname" />
		<br><br>
		<label>Sesso <select name="gender"><option value="M" <% if ( c.getGender() == 'M' ) { %> selected <% } %>>M</option>  <option value="F" <% if ( c.getGender() == 'F' ) { %> selected <% } %>>F</option> </select> </label> 
		<br><br>
			<label>Codice fiscale <html:text property="fc" styleClass="form" value="<%=c.getFc() %>" /> </label> <html:errors bundle="errorsCustomer" property="fc" />
		<br><br>
			<label>Telefono<html:text property="phone" styleClass="form" value="<%=c.getPhone() %>" /> </label> 
		<br><br>
			<label>Data di nascita <input type="date" min="1940-11-10" max="2016-10-10" value=<%=c.getBdate() %> name="bdate" value=<%=c.getBdate() %> /> </label> <html:errors bundle="errorsCustomer" property="bdate" />
		<br><br>
		<html:submit value="   Aggiorna dati " styleClass="submit" />
	</html:form>
</div>
<!-- ============== eventuale messaggio di errore ============== -->
<%if(errore!=null){%>
	<strong style="color:red; font-size: small;"><%=errore%></strong>
<%}%>
<!-- ============== eventuale messaggio di feedback ============ -->
<%if(feedback != null){%>
	<strong style="color:lime;"><%=feedback%></strong>
<%}%>

</body>
</html>